#pragma once

class CCropHelper
{
public:
	CCropHelper(UINT width0, UINT height0, BYTE *pImg0, int nBpp0);
	~CCropHelper(void);

	UINT32	width, height;
	BYTE*	pImg;
	int		nBpp;
	int		nBytespp;

	static const int nMaxDiff;
	static const BYTE nMaxAlpha;

	int getAverageH(UINT y);
	int getAverageV(UINT x);
	bool isHnearFromAverage(UINT y);
	bool isVnearFromAverage(UINT x);
	void getCropArea(UINT &x1, UINT &x2, UINT &y1, UINT &y2);
	void crop(UINT &x1, UINT &x2, UINT &y1, UINT &y2);
	void cleanUpTransparentColor();
	bool isAllFullyOpaque();
};

